<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    <h1>{{$store.state.count}}</h1>

    <button @click="fn">点击加3</button>
    <button @click="fn1">异步点击加5</button>
  </div>
</template>

<script>

export default {
  name: 'App',
  mounted(){
    console.log(this)
  },
  methods:{
    fn(){
      this.$store.commit("add",3)
    },
    fn1(){
      this.$store.dispatch("asyncAdd",5)
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
